UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uNSBtaTIhnF4fZbQ6c5FdMc8pgM1rXwViPctncBlEQ8=' 
WHERE 
  key_id = '8095755f35548eaae5e957f32618781ed7f6587dc5bdf272940719110f47ce90' 
  AND (
    token = 'uNSBtaTIhnF4fZbQ6c5FdMc8pgM1rXwViPctncBlEQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028