UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xl/z5nEGawfblppYUftncsTN0A8LAoONqLP63u6+B+s=' 
WHERE 
  key_id = 'b9a480e803d62915095d6d0d2c4ada0acd0d1c297eed218c224cb6ea77e4bf42' 
  AND (
    token = 'Xl/z5nEGawfblppYUftncsTN0A8LAoONqLP63u6+B+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038