UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DYeFRCgVztpEqgVKAal85zGmmf47+h4Ub8djBWLmJdk=' 
WHERE 
  key_id = 'd891297b4af5fae6329afc6c36c1b10f760c6228a8cc4ba4667992d6f82e67c3' 
  AND (
    token = 'DYeFRCgVztpEqgVKAal85zGmmf47+h4Ub8djBWLmJdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048