UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MluLKvSfq7cXEHi9v6IOKuwfUB5ZcrzZgKmJl2v3aWo=' 
WHERE 
  key_id = 'd43ee5c4525db0a41b7e612f9dc032dd0312734375d70836116b89e849ad9c54' 
  AND (
    token = 'MluLKvSfq7cXEHi9v6IOKuwfUB5ZcrzZgKmJl2v3aWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038