UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lcN0IZysDZwQKfeKnlTBochGonm8yeMKYArDD4vxIgw=' 
WHERE 
  key_id = '9dad7e680ee39027a6d6a9a9616a1e204c2c4ac026228f9afbbea2cd7c48dfb5' 
  AND (
    token = 'lcN0IZysDZwQKfeKnlTBochGonm8yeMKYArDD4vxIgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048