UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PdQni2vEK7NrLYZIhXyUkmpySoNWKWGhzZUHMVRsDVw=' 
WHERE 
  key_id = '0ef66aeb23f60dcdb90b4311a09d985ac4a61db15e0448ee2c3cabb7feeeeab8' 
  AND (
    token = 'PdQni2vEK7NrLYZIhXyUkmpySoNWKWGhzZUHMVRsDVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037