UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HrkyJeSXcrBjyOF+F3DimA9UbXQX8KdU1Y7hjVfXiTo=' 
WHERE 
  key_id = 'add94c36324a81f2f413914c7bcf657d1506d48bd5e61f595ffb340b1d3f14fe' 
  AND (
    token = 'HrkyJeSXcrBjyOF+F3DimA9UbXQX8KdU1Y7hjVfXiTo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046