UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mMba65jXWgPvt/i+EbffSkOHk10TefhOkocwyquCfoo=' 
WHERE 
  key_id = '780d3e9eac6931e4e2b2d50991a4f39bc65d60bc16bf04025b769a4c4b595376' 
  AND (
    token = 'mMba65jXWgPvt/i+EbffSkOHk10TefhOkocwyquCfoo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042