UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tB1QOfMhaMADBU5kT4iz3r57/0MLqamCUNKFA42f4pc=' 
WHERE 
  key_id = '5268c21e933a569ac173b4dfbb54ece981467bbced09acde5137d5532b24c79b' 
  AND (
    token = 'tB1QOfMhaMADBU5kT4iz3r57/0MLqamCUNKFA42f4pc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045