UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sYUiU1ZrmzEBt8v/5+GUzfjTZ16MYpyktqL2TuMqYeU=' 
WHERE 
  key_id = '2fadf38702d1f32e0d9ec02d5cb68daefe2ed55842358ef5c3810c35c36edc08' 
  AND (
    token = 'sYUiU1ZrmzEBt8v/5+GUzfjTZ16MYpyktqL2TuMqYeU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043