UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4wc3lGxrd+31YUeoEKAoat379Wwc9UHuWOd0POERvxc=' 
WHERE 
  key_id = '23de3cd5c03166a74c9dff21acf10ce23ebce9b8c8159a9acc93ab1b76b59388' 
  AND (
    token = '4wc3lGxrd+31YUeoEKAoat379Wwc9UHuWOd0POERvxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034