UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I4r9fYaFW70tyOPpPo378H2wVptGIrugsJaGzSFE06Y=' 
WHERE 
  key_id = '522b9fd5dfcce37fb65ccaac7efc471149b1ead7bcf488dddf3eaa1077726854' 
  AND (
    token = 'I4r9fYaFW70tyOPpPo378H2wVptGIrugsJaGzSFE06Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051