UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i1HrVwsfAlrlCbDbG4wbOwXrxUVxYx47rbc94slplMw=' 
WHERE 
  key_id = '89b1dcba7df2fa69d6f9551bf10d333c0e54651a473cba7b6b7c9e893a781cf3' 
  AND (
    token = 'i1HrVwsfAlrlCbDbG4wbOwXrxUVxYx47rbc94slplMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030