UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rvt4iicLW27k11KY7Y2SWq1HaxFbsY8Q2gmQhZTkbUY=' 
WHERE 
  key_id = '120c518e4569c3de9c2e3fe2452bcb418253002a926b721ab4ca817a6d1f269e' 
  AND (
    token = 'rvt4iicLW27k11KY7Y2SWq1HaxFbsY8Q2gmQhZTkbUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037