UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RKK4matWXX8DqPid8EKd7ueTkjksi4ntxeIPk+9iK68=' 
WHERE 
  key_id = '23e2c122af082eec6aa3ff42b2940cac69e2ba4ab0404c273769cc87c5fe4d2a' 
  AND (
    token = 'RKK4matWXX8DqPid8EKd7ueTkjksi4ntxeIPk+9iK68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014