UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NEAFioKdFepGUPDb4z9bmJshn+yAWQKHOgtGjI445TA=' 
WHERE 
  key_id = '52697ced3285d472651609e198f0f5c091a3ccf4b2d488262a53299ad131fec1' 
  AND (
    token = 'NEAFioKdFepGUPDb4z9bmJshn+yAWQKHOgtGjI445TA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00107