UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jwObZazZoaskVibxcaI8Y00pXpw8DkhstndxsOsAmaY=' 
WHERE 
  key_id = '5994771c6807c001ede179c7913721b79e909bb7902537961f483b9291dfe574' 
  AND (
    token = 'jwObZazZoaskVibxcaI8Y00pXpw8DkhstndxsOsAmaY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018