UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3d984OaIWDxPiHnFxXCqNXSq6/6nZ1IVRO5Nwj+rd/o=' 
WHERE 
  key_id = '7f460e54711de3dc8dc71dcd0fbda7ecf1ee56495195c8582915596cc809bb1a' 
  AND (
    token = '3d984OaIWDxPiHnFxXCqNXSq6/6nZ1IVRO5Nwj+rd/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024