UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D58HH0LHnnjcnfGgxWxu2j1rqL6LMGN73ij8ko3NUos=' 
WHERE 
  key_id = 'f74e50f03b891a9067db6a2d69858a28589294dc2c0d913d8396b05cd3c51024' 
  AND (
    token = 'D58HH0LHnnjcnfGgxWxu2j1rqL6LMGN73ij8ko3NUos=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033