UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LbXz77rxcDKhPwZ64j4Mmo+sxAumhmWtBzmQ+6i6ygo=' 
WHERE 
  key_id = '8db8c4c66f49399e6f1a64cf1d66a4e66709a15a84e94c504a70a0e577407cb6' 
  AND (
    token = 'LbXz77rxcDKhPwZ64j4Mmo+sxAumhmWtBzmQ+6i6ygo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028