UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vphYdH1jHKnm+oWOkycGy1UKL3tdjkqPkYD03ZW2Y/4=' 
WHERE 
  key_id = '5167e49e94c394e68e79b9372ed4dfc6861442be1074d1adb07a90585b911050' 
  AND (
    token = 'vphYdH1jHKnm+oWOkycGy1UKL3tdjkqPkYD03ZW2Y/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021