UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LweGsh/jf36nq3DjUI+0CZBhAlZezHst3xBVYqe671w=' 
WHERE 
  key_id = 'cc3f316df8de074b56d50279e98ed2b446f73165d66affd511aaeb0e953b6e73' 
  AND (
    token = 'LweGsh/jf36nq3DjUI+0CZBhAlZezHst3xBVYqe671w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018