UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y1wfJyN1Y4THm+YcwBsMebFrXMMqQXiJAkmX6kllW+I=' 
WHERE 
  key_id = 'c6c73ecd0d0019051432f01b0161f976bdb194d23cd44dca7c874f0ec9b01b98' 
  AND (
    token = 'y1wfJyN1Y4THm+YcwBsMebFrXMMqQXiJAkmX6kllW+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040