UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gSqX2oz+KUCzeeaJfA1jecj4Ey2xYjzxMZWEdIQdf9k=' 
WHERE 
  key_id = 'ff27d755b463ff0515da1f6288e941ec171b48882df57e58ff67fbe669212d6c' 
  AND (
    token = 'gSqX2oz+KUCzeeaJfA1jecj4Ey2xYjzxMZWEdIQdf9k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032