UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+dpbfqMuZacc2HoKqYsWKMiCkxn89iI215A7UZRp+V8=' 
WHERE 
  key_id = '825c67dca3639244d3ef6089c8ddf0d0e7f5cbc2181f541947509a784e660b81' 
  AND (
    token = '+dpbfqMuZacc2HoKqYsWKMiCkxn89iI215A7UZRp+V8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029