UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eaKObs4Vat0n3h5dzvUFfyHm0zDlRu7fE3h50AGRHnM=' 
WHERE 
  key_id = '5bb2dcfd225810bc1afbc961378b46fdf91c316be37da61d9c12e13c2a3e46b9' 
  AND (
    token = 'eaKObs4Vat0n3h5dzvUFfyHm0zDlRu7fE3h50AGRHnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026