UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WKpxS4bpacoAZhyA74lVykIOgA04G85wJBGkZLcKJiI=' 
WHERE 
  key_id = '395e48e410c9b364b524062c57de7666a8abf9fdf8857d4453387f462bfbcdb9' 
  AND (
    token = 'WKpxS4bpacoAZhyA74lVykIOgA04G85wJBGkZLcKJiI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054