UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4vdfA5gXV9+tSf8oi8WvKSBj4+3o0O3k0+diYLUfavM=' 
WHERE 
  key_id = 'f6fdd50550c92e1819d4f74f0b1eb3d24f3ae660509200f65ec917851cb94906' 
  AND (
    token = '4vdfA5gXV9+tSf8oi8WvKSBj4+3o0O3k0+diYLUfavM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030