UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DqvZVaGA+ho4rpoTo5RssXq9tGwR36z/dvB51OGl9Eg=' 
WHERE 
  key_id = 'eceface0960c921246b9a46a568d4c01382be6c39178130653276c712b4ecae1' 
  AND (
    token = 'DqvZVaGA+ho4rpoTo5RssXq9tGwR36z/dvB51OGl9Eg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032