UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h+i+z/aXOBAfV5WZWpwtvB/zdyBMUK1MLvHes377lm0=' 
WHERE 
  key_id = '25f23be6ed484b063230502253b6e6932be299c9f2bc40ec6738d8a03dd19a5a' 
  AND (
    token = 'h+i+z/aXOBAfV5WZWpwtvB/zdyBMUK1MLvHes377lm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037