UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F0N5pxJ10ugMc/3v7fLgWcB+9bZJTs+UbhmZ25DVL9s=' 
WHERE 
  key_id = '377b5b377fb641610d4273d5f13efca37e033494bf4eaeace7e122ef408b66f6' 
  AND (
    token = 'F0N5pxJ10ugMc/3v7fLgWcB+9bZJTs+UbhmZ25DVL9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044